Use case: SYSTICK configuration ¶
These sequences demonstrate the change in the SYSTICK configuration.
Sequence diagram ¶
Code snippet ¶
This use case demonstrates how to configure the SYSTICK timer using HAL1 compared to HAL2.
|
HAL1 |
HAL2 |
|---|---|
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
/* Fix the number of ticks between two interrupts */
TicksNumb = 1000;
uint32_t state = HAL_SYSTICK_Config(TicksNumb);
|
HAL_CORTEX_SYSTICK_SetClkSource(HAL_CORTEX_SYSTICK_CLKSOURCE_INTERNAL);
/* SysTick clock frequency is 1 MHz */
uint32_t SysTick_CLK = 1000000;
HAL_CORTEX_SYSTICK_SetFreq(SysTick_CLK);
|
Key changes ¶
In HAL2,
HAL_CORTEX_SYSTICK_Config()is replaced withHAL_CORTEX_SYSTICK_SetFreq(), which uses a frequency parameter instead of a tick count.In HAL2, the clock source is configured using
HAL_CORTEX_SYSTICK_SetClkSource().

